home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / ny_src.zip / NYEDIT.CPP < prev    next >
C/C++ Source or Header  |  1997-04-22  |  54KB  |  1,790 lines

  1. //                        0 - Critical Door error (no fossil, etc.)
  2. //                        1 - Carrier lost, user off-line
  3. //                        2 - Sysop terminated call, user off-line
  4. //                        3 - User time used up, user STILL ON-LINE
  5. //                        4 - Keyboard inactivity timeout, user off-line
  6. //                       10 - User chose to return to BBS
  7. //                       11 - User chose to logoff, user off-line
  8. //                       12 - Critical RAVote error
  9.  
  10.  
  11. // include the header
  12. #include "NYEDIT.h"
  13.  
  14.  
  15. // Declare global variables
  16. user_rec cur_user;
  17. char str[25];
  18. int single_node=FALSE;
  19. int gamedisk,flagdisk=-1;
  20. char gamedir[MAXDIR],flagdir[MAXDIR];
  21. char c_dir_g=0;
  22. int user_num=0;
  23. int time_slice_value=1500;
  24.  
  25. void
  26. time_slice(void)
  27. {
  28.   asm {
  29.     mov ax,time_slice_value
  30.     int 15
  31.   }
  32. }
  33.  
  34. void
  35. NoDropFile(void)
  36. {
  37.   printf("\nNew York 2008 Player Editor - No dropfile found!\n");
  38.   printf("To start in Local mode type:\nNYEDIT -L\n");
  39.   exit(10);
  40. }
  41.  
  42. int main(int argc,char *argv[])
  43. {
  44.   FILE *justfile;
  45.   char key,s_key;
  46.   unsigned int uintval;
  47.   unsigned long points;
  48.   char numstr[41];
  49.   scr_rec srec;
  50.   int cnt;
  51.   struct ffblk ffblk;
  52.   int cntv,intval;
  53. //  user_rec cur_user;
  54.  
  55.     //your opendoors reg here
  56.     strcpy(od_control.od_registered_to,"[UNREGISTERED]");
  57.     od_control.od_registration_key=00000000000000000000000000000000;
  58.  
  59.   directvideo=0;
  60.  
  61. //  od_control.od_clear_on_exit=FALSE;
  62.   od_control.od_no_file_func=NoDropFile;
  63.   od_control.od_disable |= DIS_BPS_SETTING;
  64.   od_control.od_disable |= DIS_NAME_PROMPT;
  65.  
  66. //  od_control.od_config_function = CustomConfigFunction;
  67.   //od_control.od_config_file = INCLUDE_CONFIG_FILE;
  68.   //od_control.od_config_filename = "NYEDIT.CFG";
  69.  
  70.  
  71.   od_control.od_config_function = CustomConfigFunction;
  72.   if(findfirst("NY2008.CFG",&ffblk,0)==0)
  73.     od_control.od_config_file = INCLUDE_CONFIG_FILE;
  74.   else
  75.     od_control.od_config_file = NO_CONFIG_FILE;
  76.   od_control.od_config_filename = "NY2008.CFG";
  77.  
  78.   od_control.od_mps=INCLUDE_MPS;
  79.   od_control.od_nocopyright=TRUE;
  80.  
  81.   if(time_slice_value>0)
  82.     od_control.od_ker_exec=time_slice;
  83.  
  84.   cnt=1;
  85.   if(argc>1) {
  86.     do {
  87.       if (strnicmp(argv[cnt],"-L",2)==0) {
  88.     od_control.od_force_local=TRUE;
  89.     clrscr();
  90.     textbackground(LIGHTCYAN);
  91.     textcolor(BLUE);
  92.     gotoxy(1,7);
  93.     cprintf("╔═════════════════════════════════════════════════════════════════════════════╗");
  94.     gotoxy(1,8);
  95.     cprintf("║ New York 2008 Player Editor                                                 ║");
  96.     gotoxy(1,9);
  97.     cprintf("║ Starting in local mode input your name: ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ║");
  98.     gotoxy(1,10);
  99.     cprintf("╚═════════════════════════════════════════════════════════════════════════════╝");
  100.     gotoxy(43,9);
  101. //      for(x=0;x<35;x++)
  102. //        putch('░');
  103.  
  104. //      cprintf(" ║\b\b");
  105.  
  106. //      for(x=0;x<35;x++)
  107. //        putch('\b');
  108.  
  109.  
  110.     int cntv=0;
  111.     intval=TRUE;
  112.     do {
  113.       if(cntv>=35) {
  114.         cntv=34;
  115.         putch('\b');
  116.         key=getch();
  117.         if(key=='\n' || key=='\r')
  118.           cntv=35;
  119.       } else {
  120.         key=getch();
  121.       }
  122.  
  123.       if(key==27) {
  124.         gotoxy(1,9);
  125.         cprintf("║ Starting in local mode input your name: ░ Canceled ... ░░░░░░░░░░░░░░░░░░░░ ║");
  126.         gotoxy(1,12);
  127.         exit(10);
  128.       }
  129.  
  130.       if(intval==TRUE) {
  131.         if (key>='a' && key<='z')
  132.           key-=32;
  133.         intval=FALSE;
  134.       } else if(intval==FALSE) {
  135.         if (key>='A' && key<='Z')
  136.           key+=32;
  137.       }
  138.       if(key==' ') {
  139.         putch('░');
  140.         key=0;
  141.         intval=TRUE;
  142.       } else if(key=='\b') {
  143.         if(cntv==0) {
  144.           intval=TRUE;
  145.           key=0;
  146.           cntv--;
  147.         } else {
  148.           cntv-=2;
  149.           if(cntv>=0 && od_control.user_name[cntv]==' ')
  150.         intval=TRUE;
  151.           if(cntv==32)
  152.         cprintf("\b░░\b\b");
  153.           else
  154.         cprintf("\b░\b");
  155.           key=0;
  156.         }
  157.       }
  158.  
  159.       if(key!=0) {
  160.         od_control.user_name[cntv]=key;
  161.         putch(key);
  162.       }
  163.       cntv++;
  164.     } while (key!='\n' && key!='\r');
  165.     od_control.user_name[cntv-1]=0;
  166.       } else if (strnicmp(argv[cnt],"-P",2)==0) {
  167.     strzcpy(od_control.info_path,argv[cnt],2,59);
  168.       } else if (strnicmp(argv[cnt],"-RDBPS",6)==0) {
  169.     od_control.od_disable &=~ DIS_BPS_SETTING;
  170.       } else if (strnicmp(argv[cnt],"-N",2)==0) {
  171.     strzcpy(numstr,argv[cnt],2,59);
  172.     sscanf(numstr,"%d",&intval);
  173.     od_control.od_node=intval;
  174.       } else if (strnicmp(argv[cnt],"-DV",3)==0) {
  175.     directvideo=1;
  176.       } else if (strnicmp(argv[cnt],"-C",2)==0) {
  177.     strzcpy(od_control.od_config_filename,argv[cnt],2,59);
  178.     od_control.od_config_file = INCLUDE_CONFIG_FILE;
  179.       }
  180.     } while ((++cnt)<=argc);
  181.   }
  182.  
  183.   od_printf("`bright`New York 2008 Player Editor Copyright 1995, George Lebl - All rights Reserved\n\r");
  184.   if(!od_control.od_force_local)
  185.     od_control.od_clear_on_exit=FALSE;
  186.   od_control.od_disable |= DIS_INFOFILE;
  187.   if(od_control.user_rip==TRUE) {
  188.     od_control.user_rip=FALSE;
  189.     od_control.user_ansi=TRUE;
  190.   }
  191.   getcwd(gamedir,MAXDIR);
  192.   gamedisk=gamedir[0] - 'A';
  193.   strzcpy(gamedir,gamedir,2,MAXDIR);
  194.   if(flagdisk==-1) {
  195.     flagdisk=gamedisk;
  196.     strcpy(flagdir,gamedir);
  197.   }
  198. //  od_control.od_ker_exec=ny_kernel;
  199.   od_control.od_help_text2=(char *)"  New York 2008 Player Editor (c) Copyright 1995 George Lebl                  ";
  200.   ch_flag_d();
  201.   if (findfirst("MAINT.RUN",&ffblk,0)==0) {
  202.     od_printf("\n\r\n\r`bright red`W`red`ell the mantanace is running on some other node so please come");
  203.     od_printf("back later, or if this is a single node bbs, notify the sysop because");
  204.     od_printf("then he should delete the MAINT.RUN flag file....");
  205.     WaitForEnter();
  206.     od_exit(10,FALSE);
  207.   }
  208.  
  209.   ch_game_d();
  210.   if (findfirst(USER_FILENAME,&ffblk,0)!=0) {
  211.     od_printf("\n\r`bright`NO user File!!!!\n\r");
  212.     od_exit(10,FALSE);
  213.   }
  214.  
  215. /*  if (findfirst("NYREG.KEY",&ffblk,0)==0) {
  216.     strcpy(numstr,od_control.system_name);
  217.     get_bbsname(numstr);
  218.     if(seereg(numstr)==FALSE) {
  219.       od_printf("\n\r\n\r`bright`UNREGISTERED... EDITOR DISABLED!!\n\r");
  220.       od_printf("\r\n`white`NOTE: If you have registered the game but the editor still\r\n");
  221.       od_printf("says it's unregistered, make sure it is reading the configuration\r\n");
  222.       od_printf("files the game is reading. Use the -C option, or make sure your\r\n");
  223.       od_printf("name and bbs name are in a file called NY2008.CFG!\n\r");
  224.  
  225.       WaitForEnter();
  226.       od_exit(10,FALSE);
  227.     }
  228.   } else {
  229.     od_printf("\n\r\n\r`bright`UNREGISTERED... EDITOR DISABLED!!\n\r");
  230.     od_printf("\r\n`white`NOTE: If you have registered the game but the editor still\r\n");
  231.     od_printf("says it's unregistered, make sure it is reading the configuration\r\n");
  232.     od_printf("files the game is reading. Use the -C option, or make sure your\r\n");
  233.     od_printf("name and bbs name are in a file called NY2008.CFG!\n\r");
  234.     WaitForEnter();
  235.     od_exit(10,FALSE);
  236.   }
  237.    */
  238.  
  239.   do {
  240.     ch_game_d();
  241.     justfile = ShareFileOpen(USER_FILENAME, "rb");
  242.  
  243.      /* If unable to access the user file, display an error message and */
  244.      /* return.                                                         */
  245.      if(justfile == NULL)
  246.      {
  247.     od_printf("Unable to access the user file.\n\r");
  248.     WaitForEnter();
  249.     od_exit(10,FALSE);
  250.      }
  251.  
  252.      /* Move to appropriate location in user file for the current user's */
  253.      /* record. */
  254.      fseek(justfile, (long)user_num * sizeof(user_rec), SEEK_SET);
  255.  
  256.      /* read record from file. */
  257.      if (ny_fread(&cur_user, sizeof(user_rec), 1, justfile) != 1)
  258.      {
  259.        user_num--;
  260.      }
  261.  
  262.      /* Close the user file to allow other nodes to access it again. */
  263.      fclose(justfile);
  264.  
  265.  
  266.  
  267.     switch(key=entry_menu())    // Get user's choice
  268.     {
  269.       case '[':
  270.     user_num--;
  271.     if (user_num<0) user_num=0;
  272.     break;
  273.  
  274.       case ']':
  275.     user_num++;
  276.     break;
  277.  
  278.       case '4':
  279.     if(cur_user.sex==MALE)
  280.       cur_user.sex=FEMALE;
  281.     else
  282.       cur_user.sex=MALE;
  283.     WriteCurrentUser(user_num);
  284.     break;
  285.  
  286.       case '5':
  287.     od_printf("\n\n\r`bright`Display Level/Minimum Points Table? (Y/N):");
  288.     s_key=od_get_answer("YN");
  289.     od_printf("%c\n\r",s_key);
  290.     if(s_key=='Y') {
  291.       od_printf("\n\n\r`bright`Level:               Min Points:`cyan`\n\r");
  292.       od_printf("0                    0\n\r");
  293.       od_printf("1                    500           `bright red`This table shows the minimum\n\r`cyan`");
  294.       od_printf("2                    1020          `bright red`points required to get into\n\r`cyan`");
  295.       od_printf("3                    2100          `bright red`a level. This editor will\n\r`cyan`");
  296.       od_printf("4                    3700          `bright red`calculate the minimum level\n\r`cyan`");
  297.       od_printf("5                    6100          `bright red`for the points entered.`cyan`\n\r");
  298.       od_printf("6                    9100\n\r");
  299.       od_printf("7                    12820\n\r");
  300.       od_printf("8                    17300\n\r");
  301.       od_printf("9                    22580\n\r");
  302.       od_printf("10                   28700\n\r");
  303.       od_printf("11                   35700\n\r");
  304.       od_printf("12                   43620\n\r");
  305.       od_printf("13                   52500\n\r");
  306.       od_printf("14                   62380\n\r");
  307.       od_printf("15                   73300\n\r");
  308.       od_printf("16                   85300\n\r");
  309.       od_printf("17                   98420\n\r");
  310.       od_printf("18                   112700\n\r");
  311.       od_printf("19                   128180\n\r");
  312.       od_printf("20                   144900");
  313.     }
  314.  
  315.     od_printf("\n\r`bright`Enter amount of points, ENTER to abort:");
  316.     od_input_str(numstr,25,'0','9');
  317.     if (numstr[0]!=0){
  318.       sscanf(numstr,"%lu",&points);
  319.       if(points>cur_user.points) {
  320.         set_points(points);
  321.         WriteCurrentUser(user_num);
  322.         SortScrFile(user_num);
  323.       } else if(points<cur_user.points) {
  324.         set_points(points);
  325.         WriteCurrentUser(user_num);
  326.         SortScrFileB(user_num);
  327.       }
  328.     }
  329.     break;
  330.  
  331.  
  332.       case 'M':
  333.     od_printf("\n\r\n\r`bright`Enter amount of money at hand, ENTER to abort:");
  334.     od_input_str(numstr,25,'0','9');
  335.     if (numstr[0]!=0){
  336.       sscanf(numstr,"%lu",&cur_user.money);
  337.       WriteCurrentUser(user_num);
  338.     }
  339.     break;
  340.  
  341.       case 'N':
  342.     od_printf("\n\r\n\r`bright`Enter amount of money in bank, ENTER to abort:");
  343.     od_input_str(numstr,25,'0','9');
  344.     if (numstr[0]!=0){
  345.       sscanf(numstr,"%lu",&cur_user.bank);
  346.       WriteCurrentUser(user_num);
  347.     }
  348.     break;
  349.  
  350.       case '1':
  351. //        od_control.od_ker_exec=NULL;
  352.       od_printf("\n\r\n\r`bright`Enter the new identity:\n\r\n\r");
  353.       od_printf("`bright green`1`green`. `bright green`H`green`eadbanger\n\r");
  354.       od_printf("`bright green`2`green`. `bright green`H`green`ippie\n\r");
  355.       od_printf("`bright green`3`green`. `bright green`B`green`ig `bright green`F`green`at `bright green`D`green`ude\n\r");
  356.       od_printf("`bright green`4`green`. `bright green`C`green`rack `bright green`A`green`ddict\n\r");
  357.       od_printf("`bright green`5`green`. `bright green`P`green`unk\n\r\n\r");
  358.       od_printf("`bright`ENTER to cancel:");
  359. //        od_control.od_ker_exec=ny_kernel;
  360.       s_key=od_get_answer("12345\n\r");
  361.       od_printf("%c\n\r\n\r",key);
  362.  
  363.       if (s_key=='1') cur_user.nation = HEADBANGER;
  364.        else if (s_key=='2') cur_user.nation = HIPPIE;
  365.        else if (s_key=='3') cur_user.nation = BIG_FAT_DUDE;
  366.        else if (s_key=='4') cur_user.nation = CRACK_ADDICT;
  367.        else if (s_key=='5') cur_user.nation = PUNK;
  368.       else break;
  369.       set_points(cur_user.points);
  370.       WriteCurrentUser(user_num);
  371.       break;
  372.  
  373.  
  374.       case '6':
  375. //      od_control.od_ker_exec=NULL;
  376.     od_printf("\n\r\n\r`bright`Enter fights left, ENTER to abort:");
  377. //      od_control.od_ker_exec=ny_kernel;
  378.     od_input_str(numstr,25,'0','9');
  379.     if (numstr[0]!=0){
  380.       sscanf(numstr,"%d",&cur_user.turns);
  381.       WriteCurrentUser(user_num);
  382.     }
  383.     break;
  384.  
  385.       case '7':
  386.     od_printf("\n\r\n\r`bright`Enter hitpoints, ENTER to abort:");
  387.     od_input_str(numstr,25,'0','9');
  388.     if (numstr[0]!=0){
  389.       sscanf(numstr,"%ld",&cur_user.hitpoints);
  390.  
  391.     }
  392.     od_printf("\n\r\n\r`bright`Enter maximum hitpoints, ENTER to abort:");
  393.     od_input_str(numstr,25,'0','9');
  394.     if (numstr[0]!=0){
  395.       sscanf(numstr,"%ld",&cur_user.maxhitpoints);
  396.     }
  397.     if(cur_user.maxhitpoints<1) cur_user.maxhitpoints=1;
  398.     if(cur_user.hitpoints<0) cur_user.hitpoints=0;
  399.     if(cur_user.hitpoints>cur_user.maxhitpoints) cur_user.hitpoints=cur_user.maxhitpoints;
  400.     WriteCurrentUser(user_num);
  401.     break;
  402.  
  403.  
  404.       case 'H':
  405.     od_printf("\n\r\n\r`bright`Enter the drug high, ENTER to abort:");
  406.     od_input_str(numstr,25,'0','9');
  407.     if (numstr[0]!=0){
  408.       sscanf(numstr,"%d",&intval);
  409.       if(intval>100) intval=100;
  410.       if(intval<0) intval=0;
  411.       cur_user.drug_high=intval;
  412.       WriteCurrentUser(user_num);
  413.     }
  414.     break;
  415.  
  416.       case 'O':
  417.     od_printf("\n\r\n\r`bright`Enter hunger, ENTER to abort:");
  418.     od_input_str(numstr,25,'0','9');
  419.     if (numstr[0]!=0){
  420.       sscanf(numstr,"%d",&intval);
  421.       if(intval>100) intval=100;
  422.       if(intval<0) intval=0;
  423.       cur_user.hunger=intval;
  424.       WriteCurrentUser(user_num);
  425.     }
  426.     break;
  427.  
  428.       case 'R':
  429.     if (cur_user.std!=NONE) {
  430.       od_printf("\n\r\n\r`bright`Enter the infection, ENTER to abort:");
  431.       od_input_str(numstr,25,'0','9');
  432.       if (numstr[0]!=0){
  433.         sscanf(numstr,"%d",&intval);
  434.         if(intval>100) intval=100;
  435.         if(intval<0) intval=0;
  436.         cur_user.std_percent=intval;
  437.         WriteCurrentUser(user_num);
  438.       }
  439.     } else {
  440.       od_printf("\n\r\n\r`bright`Player is healthy!");
  441.       WaitForEnter();
  442.     }
  443.     break;
  444.  
  445.  
  446.  
  447.       case '8':
  448. //          od_control.od_ker_exec=NULL;
  449.  
  450.         od_printf("\n\r\n\r`bright`Which weapon:\n\r\n\r");
  451.         ny_disp_emu("`%X`2. `0H`2ands\n\r");
  452.         ny_disp_emu("`%A`2. `0P`2epper `0S`2pray\n\r");
  453.         ny_disp_emu("`%B`2. `0S`2harp `0S`2tick\n\r");
  454.         ny_disp_emu("`%C`2. `0S`2crewdriver\n\r");
  455.         ny_disp_emu("`%D`2. `0K`2nife\n\r");
  456.         ny_disp_emu("`%E`2. `0H`2ammer\n\r");
  457.         ny_disp_emu("`%F`2. `0C`2hain\n\r");
  458.         ny_disp_emu("`%G`2. `0L`2ead `0P`2ipe\n\r");
  459.         ny_disp_emu("`%H`2. `0G`2un\n\r");
  460.         ny_disp_emu("`%I`2. `0C`2olt\n\r");
  461.         ny_disp_emu("`%J`2. `0R`2ifle\n\r");
  462.         ny_disp_emu("`%K`2. `0E`2lephant `0G`2un\n\r");
  463.         ny_disp_emu("`%L`2. `0L`2aser `0G`2un\n\r");
  464.         ny_disp_emu("`%M`2. `0N`2ail `0G`2un\n\r");
  465.         ny_disp_emu("`%N`2. `0S`2hotgun\n\r");
  466.         ny_disp_emu("`%O`2. `0A`2ssault Rifle\n\r");
  467.         ny_disp_emu("`%P`2. `0M`2achine `0G`2un\n\r");
  468.         ny_disp_emu("`%Q`2. `0P`2roton `0G`2un\n\r");
  469.         ny_disp_emu("`%R`2. `0G`2ranade `0L`2auncher\n\r");
  470.         WaitForEnter();
  471.         ny_disp_emu("\n\r\n`%S`2. `0N`2eutron `0P`2haser\n\r");
  472.         ny_disp_emu("`%T`2. `0B`2laster\n\r");
  473.         ny_disp_emu("`%U`2. `0U`2ltrasound `0G`2un\n\r");
  474.         ny_disp_emu("`%V`2. `0A`2tomic `0B`2omb\n\r");
  475.  
  476.         od_printf("\n\r`bright`Which one? ENTER to abort:");
  477. //          od_control.od_ker_exec=ny_kernel;
  478.         s_key=od_get_answer("XABCDEFGHIJKLMNOPQRSTUV\n\r");
  479.         od_printf("%c",s_key);
  480.  
  481.         if (s_key=='A') cur_user.arm=PEPPER;
  482.         else if (s_key=='B') cur_user.arm=SHARP_STICK;
  483.         else if (s_key=='C') cur_user.arm=SCREWDRIVER;
  484.         else if (s_key=='D') cur_user.arm=KNIFE;
  485.         else if (s_key=='E') cur_user.arm=HAMMER;
  486.         else if (s_key=='F') cur_user.arm=CHAIN;
  487.         else if (s_key=='G') cur_user.arm=LEAD_PIPE;
  488.         else if (s_key=='H') cur_user.arm=GUN;
  489.         else if (s_key=='I') cur_user.arm=COLT;
  490.         else if (s_key=='J') cur_user.arm=RIFLE;
  491.         else if (s_key=='K') cur_user.arm=ELEPHANT_GUN;
  492.         else if (s_key=='L') cur_user.arm=LASER_GUN;
  493.         else if (s_key=='M') cur_user.arm=NAILGUN;
  494.         else if (s_key=='N') cur_user.arm=SHOTGUN;
  495.         else if (s_key=='O') cur_user.arm=ASSAULT_RIFLE;
  496.         else if (s_key=='P') cur_user.arm=MACHINEGUN;
  497.         else if (s_key=='Q') cur_user.arm=PROTON_GUN;
  498.         else if (s_key=='R') cur_user.arm=GRANADE_LAUNCHER;
  499.         else if (s_key=='S') cur_user.arm=NEUTRON_PHASER;
  500.         else if (s_key=='T') cur_user.arm=BLASTER;
  501.         else if (s_key=='U') cur_user.arm=ULTRASOUND_GUN;
  502.         else if (s_key=='V') cur_user.arm=A_BOMB;
  503.         else if (s_key=='X') cur_user.arm=HANDS;
  504.         else break;
  505.         WriteCurrentUser(user_num);
  506.         break;
  507.  
  508.       case 'I':
  509.     if (cur_user.drug>=COKE) {
  510.       od_printf("\n\r\n\r`bright`Enter the drug addiction, ENTER to abort:");
  511.       od_input_str(numstr,25,'0','9');
  512.       if (numstr[0]!=0){
  513.         sscanf(numstr,"%d",&intval);
  514.         if(intval>100) intval=100;
  515.         if(intval<0) intval=0;
  516.         cur_user.drug_addiction=intval;
  517.         WriteCurrentUser(user_num);
  518.       }
  519.     } else {
  520.       od_printf("\n\r\n\r`bright`Player not using addictive drug!");
  521.       WaitForEnter();
  522.     }
  523.     break;
  524.  
  525.       case 'J':
  526.     if (cur_user.drug>=COKE) {
  527.       od_printf("\n\r\n\r`bright`Enter the days since last hit, ENTER to abort:");
  528.       od_input_str(numstr,25,'0','9');
  529.       if (numstr[0]!=0){
  530.         sscanf(numstr,"%d",&intval);
  531.         if(intval<0) intval=0;
  532.         cur_user.drug_days_since=intval;
  533.         WriteCurrentUser(user_num);
  534.       }
  535.     } else {
  536.       od_printf("\n\r\n\r`bright`Player not using addictive drug!");
  537.       WaitForEnter();
  538.     }
  539.     break;
  540.  
  541.  
  542.       case 'A':
  543.     od_printf("\n\r\n\r`bright`Enter days since laid, ENTER to abort:");
  544.     od_input_str(numstr,25,'0','9');
  545.     if (numstr[0]!=0){
  546.       sscanf(numstr,"%d",&cur_user.since_got_laid);
  547.       if(cur_user.since_got_laid<0) cur_user.since_got_laid=0;
  548.       WriteCurrentUser(user_num);
  549.     }
  550.     break;
  551.  
  552.       case 'B':
  553.     od_printf("\n\r\n\r`bright`Enter sex turns left, ENTER to abort:");
  554.     od_input_str(numstr,25,'0','9');
  555.     if (numstr[0]!=0){
  556.       sscanf(numstr,"%d",&intval);
  557.       if(intval>255) intval=255;
  558.       if(intval<0) intval=0;
  559.       cur_user.sex_today=intval;
  560.       WriteCurrentUser(user_num);
  561.     }
  562.     break;
  563.  
  564.       case 'C':
  565.     od_printf("\n\r\n\r`bright`Enter # of condoms, ENTER to abort:");
  566.     od_input_str(numstr,25,'0','9');
  567.     if (numstr[0]!=0){
  568.       sscanf(numstr,"%d",&cur_user.condoms);
  569.       if(cur_user.condoms<0) cur_user.condoms=0;
  570.       WriteCurrentUser(user_num);
  571.     }
  572.     break;
  573.  
  574.       case 'D':
  575.     od_printf("\n\r\n\r`bright`Enter # of rocks, ENTER to abort:");
  576.     od_input_str(numstr,25,'0','9');
  577.     if (numstr[0]!=0){
  578.       sscanf(numstr,"%d",&cur_user.rocks);
  579. //        if(cur_user.rocks<0) cur_user.rocks=0;
  580.       WriteCurrentUser(user_num);
  581.     }
  582.     break;
  583.  
  584.       case 'E':
  585.     od_printf("\n\r\n\r`bright`Enter the Throwing Ability (0-100), ENTER to abort:");
  586.     od_input_str(numstr,25,'0','9');
  587.     if (numstr[0]!=0) {
  588.       sscanf(numstr,"%d",&intval);
  589.       cur_user.throwing_ability=intval;
  590. //        if(cur_user.throwing_ability<0) cur_user.throwing_ability=0;
  591.       if(cur_user.throwing_ability>100) cur_user.throwing_ability=100;
  592.       WriteCurrentUser(user_num);
  593.     }
  594.     od_printf("\n\r\n\r`bright`Enter the Kicking Ability (0-100), ENTER to abort:");
  595.     od_input_str(numstr,25,'0','9');
  596.     if (numstr[0]!=0){
  597.       sscanf(numstr,"%d",&intval);
  598.       cur_user.kick_ability=intval;
  599. //        if(cur_user.kick_ability<0) cur_user.kick_ability=0;
  600.       if(cur_user.kick_ability>100) cur_user.kick_ability=100;
  601.       WriteCurrentUser(user_num);
  602.     }
  603.     od_printf("\n\r\n\r`bright`Enter the Punching Ability (0-100), ENTER to abort:");
  604.     od_input_str(numstr,25,'0','9');
  605.     if (numstr[0]!=0){
  606.       sscanf(numstr,"%d",&intval);
  607.       cur_user.punch_ability=intval;
  608. //        if(cur_user.punch_ability<0) cur_user.punch_ability=0;
  609.       if(cur_user.punch_ability>100) cur_user.punch_ability=100;
  610.       WriteCurrentUser(user_num);
  611.     }
  612.  
  613.     break;
  614.  
  615.  
  616.  
  617.       case 'G':
  618.     od_printf("\n\r\n\r`bright`Enter # of drug hits, ENTER to abort:");
  619.     od_input_str(numstr,25,'0','9');
  620.     if (numstr[0]!=0){
  621.       sscanf(numstr,"%d",&cur_user.drug_hits);
  622.       if(cur_user.drug_hits<0) cur_user.drug_hits=0;
  623.       WriteCurrentUser(user_num);
  624.     }
  625.     break;
  626.  
  627.  
  628.  
  629.  
  630.       case '3':
  631.     od_printf("\n\r\n\r`bright`Input the new USER BBS name, ENTER to abort:");
  632.     cntv=0;
  633.     intval=TRUE;
  634.     do {
  635.       //scanf("%c",&key);
  636.       s_key=od_get_key(TRUE);
  637.       if(intval==TRUE) {
  638.         if (s_key>='a' && s_key<='z')
  639.           s_key-=32;
  640.         intval=FALSE;
  641.       } else if(intval==FALSE) {
  642.         if (s_key>='A' && s_key<='Z')
  643.           s_key+=32;
  644.       }
  645.       if(s_key==' ')
  646.         intval=TRUE;
  647.       else if(s_key=='\b') {
  648.         if(cntv==0) {
  649.           intval=TRUE;
  650.           s_key=0;
  651.         } else {
  652.           cntv-=2;
  653.           if(cntv>=0 && numstr[cntv]==' ')
  654.         intval=TRUE;
  655.           od_printf("\b \b");
  656.           s_key=0;
  657.         }
  658.       }
  659.  
  660.       if(s_key!=0) {
  661.         numstr[cntv]=s_key;
  662.         od_putch(s_key);
  663.       }
  664.       cntv++;
  665.     } while (s_key!='\n' && s_key!='\r' && cntv<35);
  666.     numstr[cntv-1]=0;
  667.     if (s_key!='\n' && s_key!='\r') dump();
  668.     if (numstr[0]!=0){
  669.       strcpy(cur_user.bbsname,numstr);
  670.       WriteCurrentUser(user_num);
  671.     }
  672.     /*od_input_str(numstr,35,' ',255);
  673.     if (numstr[0]!=0) {
  674.       cap_names(numstr);
  675.       strcpy(cur_user.bbsname,numstr);
  676.  
  677.     } */
  678.     break;
  679.  
  680.       case '2':
  681.     od_printf("\n\r\n\r`bright`Input the new name, ENTER to abort:");
  682.     od_input_str(numstr,25,' ',255);
  683.     if (numstr[0]!=0){
  684.       strcpy(cur_user.name,numstr);
  685.       WriteCurrentUser(user_num);
  686.     }
  687.     break;
  688.       case '9':
  689. //      od_control.od_ker_exec=NULL;
  690.     od_printf("\n\r`bright red`W`red`hat does the player say when he wins:\n\r|--------------------------------------|\n\r`bright green`");
  691. //      od_control.od_ker_exec=ny_kernel;
  692.     od_input_str(numstr,40,' ',255);
  693.     if (numstr[0]!=0) {
  694.       strcpy(cur_user.say_win,numstr);
  695.       WriteCurrentUser(user_num);
  696.     }
  697.     break;
  698.  
  699.       case '0':
  700. //      od_control.od_ker_exec=NULL;
  701.     od_printf("\n\r`bright red`W`red`hat does the player say when he looses:\n\r|--------------------------------------|\n\r`bright green`");
  702. //      od_control.od_ker_exec=ny_kernel;
  703.     od_input_str(numstr,40,' ',255);
  704.     if (numstr[0]!=0) {
  705.       strcpy(cur_user.say_loose,numstr);
  706.       WriteCurrentUser(user_num);
  707.     }
  708.     break;
  709.  
  710.       case 'P':
  711. //      od_control.od_ker_exec=NULL;
  712.     od_printf("\n\r\n\r`bright`1. `bright green`H`green`ealthy\n\r");
  713.     od_printf("`bright`2. `bright green`C`green`raps\n\r");
  714.     od_printf("`bright`3. `bright green`H`green`erpes\n\r");
  715.     od_printf("`bright`4. `bright green`S`green`yphilis\n\r");
  716.     od_printf("`bright`5. `bright green`A`green`IDS\n\r\n\r");
  717.     od_printf("`bright`Enter the disease, ENTER to abort:");
  718. //      od_control.od_ker_exec=ny_kernel;
  719.     s_key=od_get_answer("12345\n\r");
  720.     od_putch(s_key);
  721.     if (s_key=='1') cur_user.std=NONE;
  722.     else if (s_key=='2') cur_user.std=CRAPS;
  723.     else if (s_key=='3') cur_user.std=HERPES;
  724.     else if (s_key=='4') cur_user.std=SYPHILIS;
  725.     else if (s_key=='5') cur_user.std=AIDS;
  726.     else break;
  727.     WriteCurrentUser(user_num);
  728.     break;
  729.  
  730.  
  731.       case 'K':
  732. //      od_control.od_ker_exec=NULL;
  733.     od_printf("\n\r\n\r`bright`1. `bright green`N`green`owhere\n\r");
  734.     od_printf("`bright`2. `bright green`C`green`heap `bright green`M`green`otel\n\r");
  735.     od_printf("`bright`3. `bright green`R`green`egular `bright green`H`green`otel\n\r");
  736.     od_printf("`bright`4. `bright green`E`green`xpensive `bright green`H`green`otel\n\r\n\r");
  737.     od_printf("`bright`Where is the user staying, ENTER to abort:");
  738. //      od_control.od_ker_exec=ny_kernel;
  739.     s_key=od_get_answer("1234\n\r");
  740.     od_putch(s_key);
  741.     if (s_key=='1') cur_user.rest_where=NOWHERE;
  742.     else if (s_key=='2') cur_user.rest_where=MOTEL;
  743.     else if (s_key=='3') cur_user.rest_where=REG_HOTEL;
  744.     else if (s_key=='4') cur_user.rest_where=EXP_HOTEL;
  745.     else break;
  746.     if(cur_user.rest_where==NOWHERE) {
  747.       cur_user.hotel_paid_fer=0;
  748.     } else {
  749.       od_printf("\n\r\n\r`bright`How long is it paid for, ENTER to abort:");
  750.       od_input_str(numstr,25,'0','9');
  751.       if (numstr[0]!=0){
  752.         sscanf(numstr,"%d",&intval);
  753.         if(intval>255) intval=255;
  754.         if(intval<0) intval=0;
  755.         cur_user.hotel_paid_fer=intval;
  756.       }
  757.     }
  758.     WriteCurrentUser(user_num);
  759.     break;
  760.       case 'F':
  761. //      od_control.od_ker_exec=NULL;
  762.     od_printf("\n\r\n\r`bright`1. `bright green`P`green`ot\n\r");
  763.     od_printf("`bright`2. `bright green`H`green`ash\n\r");
  764.     od_printf("`bright`3. `bright green`L`green`SD\n\r");
  765.     od_printf("`bright`4. `bright green`C`green`oke\n\r");
  766.     od_printf("`bright`5. `bright green`P`green`CP\n\r");
  767.     od_printf("`bright`6. `bright green`H`green`eroin\n\r");
  768.     od_printf("\n\r`bright`Select drug, ENTER to abort:");
  769. //      od_control.od_ker_exec=ny_kernel;
  770.     s_key=od_get_answer("123456\n\r");
  771.     od_putch(s_key);
  772.     if (s_key=='1') cur_user.drug=POT;
  773.     else if (s_key=='2') cur_user.drug=HASH;
  774.     else if (s_key=='3') cur_user.drug=LSD;
  775.     else if (s_key=='4') cur_user.drug=COKE;
  776.     else if (s_key=='5') cur_user.drug=PCP;
  777.     else if (s_key=='6') cur_user.drug=HEROIN;
  778.     else break;
  779.     if (cur_user.drug<COKE) {
  780.       cur_user.drug_addiction=0;
  781.       cur_user.drug_days_since=0;
  782.     }
  783.     WriteCurrentUser(user_num);
  784.     break;
  785.  
  786. /*      case '#':
  787.     printf("\n\nPoints: ");
  788.     scanf("%lu",&cur_user.points);
  789.     scanf("%c",&key);
  790.     printf("\n\nWeapon: ");
  791.     scanf("%d",&cur_user.arm);
  792.     scanf("%c",&key);
  793.     WriteCurrentUser(user_num);
  794.     break;
  795.  
  796.       case 'R':
  797.     od_printf("\n\r\n\r`bright`Revive Player?:");
  798.     key=od_get_answer("YN");
  799.     if (key=='Y') {
  800.       cur_user.alive=ALIVE;
  801.       cur_user.hitpoints=cur_user.maxhitpoints;
  802.       WriteCurrentUser(user_num);
  803.     }
  804.     break;*/
  805.  
  806.       case 'L':
  807.     if(cur_user.alive==ALIVE)
  808.       cur_user.alive=UNCONCIOUS;
  809.     else
  810.       cur_user.alive=ALIVE;
  811.     WriteCurrentUser(user_num);
  812.     break;
  813.  
  814.       case '*':
  815.     od_printf("\n\r\n\r`bright`New day for Player?(Y/N):");
  816.     key=od_get_answer("YN");
  817.     if (key=='Y') {
  818.       cur_user.days_not_on=1;
  819.       WriteCurrentUser(user_num);
  820.     }
  821.     break;
  822.  
  823.       case 'X':
  824.     od_printf("\n\r\n\r`bright`KILL Player?(Y/N):");
  825.     key=od_get_answer("YN");
  826.     if (key=='Y') {
  827.       cur_user.alive=DEAD;
  828.       WriteCurrentUser(user_num);
  829.     }
  830.     break;
  831.     }                            // Loop until quit to BBS
  832.  
  833.   } while(key!='Q');
  834.  
  835.   od_exit(10,FALSE);              // Again OpenDoors does the rest
  836.  
  837.   return(0);
  838. }
  839.  
  840. char *D_Num(int num)
  841. {
  842.   char temp[8];
  843.   int cnt,cnt2,len,sign=0;
  844.   if (num<0) {
  845.     sign=1;
  846.     str[0]='-';
  847.   }
  848.  
  849.   sprintf(temp,"%d",num);
  850.  
  851.   len=strlen(temp);
  852.  
  853.   if (len<=4) {
  854.     strcpy(str,temp);
  855.     return str;
  856.   }
  857.  
  858.   cnt2=sign;
  859.   for(cnt=sign;cnt<len-1;cnt++) {
  860.     str[cnt2]=temp[cnt];
  861.     if ( ( (int)((len-cnt-.00099)/3) *3) == (len-cnt-1) ) {
  862.       cnt2++;
  863.       str[cnt2]=',';
  864.     }
  865.     cnt2++;
  866.   }
  867.   str[cnt2]=temp[cnt];
  868.   str[cnt2+1]=0;
  869.   return str;
  870. }
  871.  
  872.  
  873.  
  874. char *D_Num(long num)
  875. {
  876.   char temp[15];
  877.   int cnt,cnt2,len,sign=0;
  878.   if (num<0) {
  879.     sign=1;
  880.     str[0]='-';
  881.   }
  882.  
  883.   sprintf(temp,"%ld",num);
  884.  
  885.   len=strlen(temp);
  886.  
  887.   if (len<=4) {
  888.     strcpy(str,temp);
  889.     return str;
  890.   }
  891.  
  892.   cnt2=sign;
  893.   for(cnt=sign;cnt<len-1;cnt++) {
  894.     str[cnt2]=temp[cnt];
  895.     if ( ((int)((len-cnt-.00099)/3)*3) == (len-cnt-1) ) {
  896.       cnt2++;
  897.       str[cnt2]=',';
  898.     }
  899.     cnt2++;
  900.   }
  901.   str[cnt2]=temp[cnt];
  902.   str[cnt2+1]=0;
  903.  
  904.   return str;
  905. }
  906.  
  907. char *D_Num(unsigned long num)
  908. {
  909.   char temp[14];
  910.   int cnt,cnt2,len;
  911.  
  912.   sprintf(temp,"%lu",num);
  913.  
  914.   len=strlen(temp);
  915.  
  916.   if (len<=4) {
  917.     strcpy(str,temp);
  918.     return str;
  919.   }
  920.  
  921.   cnt2=0;
  922.   for(cnt=0;cnt<len-1;cnt++) {
  923.     str[cnt2]=temp[cnt];
  924.     if ( ((int)((len-cnt-.00099)/3)*3) == (len-cnt-1) ) {
  925.       cnt2++;
  926.       str[cnt2]=',';
  927.     }
  928.     cnt2++;
  929.   }
  930.   str[cnt2]=temp[cnt];
  931.   str[cnt2+1]=0;
  932.  
  933.   return str;
  934. }
  935.  
  936.  
  937. void
  938. dump(void)
  939. {
  940.   char key;
  941.   do {
  942.     scanf("%c",&key);
  943.   } while (key!='\n');
  944. }
  945.  
  946.  
  947. void
  948. cap_names(char name[])
  949. {
  950.   int cnt=0;
  951.   int cap=TRUE;
  952.  
  953.   while (name[cnt]!=0) {
  954.     if (cap==TRUE) {
  955.       if (name[cnt]>='a' && name[cnt]<='z')
  956.     name[cnt]-=32;
  957.     } else {
  958.       if (name[cnt]>='A' && name[cnt]<='Z')
  959.     name[cnt]+=32;
  960.     }
  961.  
  962.     cnt++;
  963.  
  964.     if (name[cnt-1]==' ')
  965.       cap=TRUE;
  966.     else
  967.       cap=FALSE;
  968.  
  969.   }
  970. }
  971.  
  972.  
  973.  
  974. /*copy end chars  beginning from beg to dest*/
  975. /*podobny strncpy*/
  976. void
  977. strzcpy(char dest[],const char src[], int beg,int end)
  978. {
  979.   int cnt=0;
  980.   do {
  981.     dest[cnt]=src[beg];
  982.     beg++;
  983.     cnt++;
  984.   } while (cnt<=end && src[cnt]!=0);
  985.   dest[cnt]=0;
  986. }
  987.  
  988.  
  989.  
  990.  
  991.  
  992. void
  993. ny_kernel(void)
  994. {
  995.   ffblk ffblk;
  996.  
  997.   ch_flag_d();
  998.   if (findfirst("MAINT.RUN",&ffblk,0)==0) {
  999.     fcloseall();
  1000. //    od_control.od_disable|=DIS_CARRIERDETECT;
  1001.     od_printf("\n\r\n\r`bright`Please wait while maintanance runs on another node....");
  1002.  
  1003.     while (findfirst("MAINT.RUN",&ffblk,0)==0) ;
  1004.  
  1005.     od_printf("\n\rThanks For Waiting....\n\r");
  1006.  
  1007. //    od_control.od_disable&=~DIS_CARRIERDETECT;
  1008.   }
  1009.   ch_game_d();
  1010. }
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016. char entry_menu(void)
  1017.    {
  1018.    char key;
  1019.    ffblk ffblk;
  1020.    char numstr[15];
  1021.  
  1022.    od_clear_keybuffer();               // Clear any pending keys in buffer
  1023.    od_clr_scr();                       // Clear screen
  1024.  
  1025.    DisplayStats();
  1026.  
  1027.    ch_flag_d();
  1028.    sprintf(numstr,"u%07d.on",user_num);
  1029. //   od_control.od_ker_exec=NULL;
  1030.    if(findfirst(numstr,&ffblk,0)==0) {
  1031.      od_printf("`bright`]`red`/`bright`[`red` - Next/Previous  `bright`Q`red` - Quit\n\r");
  1032.      od_printf("`bright`This user is online and cannot be editted!");
  1033.      key= od_get_answer("[]Q");
  1034. //     od_control.od_ker_exec=ny_kernel;
  1035.    } else {
  1036.      od_printf("`bright`]`red`/`bright`[`red` - Next/Previous `bright`X`red` - Delete `bright`*`red` - New Day `bright``red` `bright`Q`red` - Quit\n\r");
  1037.      od_printf("`bright red`P`red`ress the number/letter corresponding to what you want to change: ");
  1038.      //od_printf("`bright`R`red` - Revive Player `bright`D`red` - Delete`bright`
  1039.      // Q - Quit:");
  1040. //     od_control.od_ker_exec=ny_kernel;
  1041.      key= od_get_answer("1234567890ABCDEFGHIJKLMNOPR[]XQ*");
  1042.    }
  1043.    return(key);
  1044. }
  1045.  
  1046. /*user stats display*/
  1047. void
  1048. DisplayStats(void)
  1049. {
  1050.   int intval;
  1051.  
  1052.   ny_kernel();
  1053. //  od_control.od_ker_exec=NULL;
  1054.   od_printf("\n\r\n\r");
  1055.   od_clr_scr();
  1056.   od_printf("`bright`S`cyan`t`bright blue`ats `bright`F`cyan`o`bright blue`r `bright`L`cyan`e`bright blue`vel `white`%d `bright`1. ",(int)cur_user.level);
  1057.   if (cur_user.nation==HEADBANGER)
  1058.     od_printf("`bright green`H`green`eadbanger");
  1059.   else if (cur_user.nation==HIPPIE)
  1060.     od_printf("`bright green`H`green`ippie");
  1061.   else if (cur_user.nation==BIG_FAT_DUDE)
  1062.     od_printf("`bright green`B`green`ig `bright green`F`green`at `bright green`D`green`ude");
  1063.   else if (cur_user.nation==CRACK_ADDICT)
  1064.     od_printf("`bright green`C`green`rack `bright green`A`green`ddict");
  1065.   else if (cur_user.nation==PUNK)
  1066.     od_printf("`bright green`P`green`unk");
  1067.   od_printf(" `bright`2. `bright red`");
  1068.   ny_disp_emu(cur_user.name);
  1069.   od_printf("\n\r`bright`3. `white`User name:`bright`%s\n\r",cur_user.bbsname);
  1070. //  od_printf("`blue`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  1071.   if (cur_user.sex==MALE)
  1072.     od_printf("`bright`4. `bright red`S`red`ex: `bright green`M`green`ale  ");
  1073.   else
  1074.     od_printf("`bright`4. `bright red`S`red`ex: `bright green`F`green`emale");
  1075.   od_repeat(' ',29);
  1076.   if (cur_user.alive==ALIVE)
  1077.     od_printf("`bright`L. `bright red`S`red`tatus: `bright green`A`green`live\n\r");
  1078.   else if (cur_user.alive==DEAD)
  1079.     od_printf("`bright`L. `bright red`S`red`tatus: `bright red`DEAD\n\r");
  1080.   else
  1081.     od_printf("`bright`L. `bright red`S`red`tatus: `bright red`UNCONSIOUS\n\r");
  1082.   od_printf("`bright`5. `bright red`P`red`oints: `bright green`%-16s",D_Num(cur_user.points));
  1083.   od_repeat(' ',16);
  1084.   od_printf("`bright`M. `bright red`M`red`oney `bright red`I`red`n `bright red`H`red`and: `bright green`%s\n\r",D_Num(cur_user.money));
  1085.   od_printf("`bright`6. `bright red`F`red`ights: `bright green`%-3d", (int)cur_user.turns);
  1086.   od_repeat(' ',29);
  1087.   od_printf("`bright`N. `bright red`M`red`oney `bright red`I`red`n `bright red`B`red`ank: `bright green`%s\n\r",D_Num(cur_user.bank));
  1088.   od_printf("`bright`7. `bright red`H`red`it `bright red`P`red`oints: `bright green`%s ",D_Num(cur_user.hitpoints));
  1089.   intval=strlen(str);
  1090.   od_printf("`bright red`o`red`f `bright green`%-9s", D_Num(cur_user.maxhitpoints));
  1091.   od_repeat(' ',40-intval-25);
  1092.   od_printf("`bright`O. `bright red`H`red`ungry: `bright green`%d%c\n\r", (int)cur_user.hunger,37);
  1093.   od_printf("`bright`8. `bright red`A`red`rm: ");
  1094.   print_arm(cur_user.arm);
  1095.   od_printf("\n\r`bright`9. `bright red`W`red`inning `bright red`S`red`entence: `bright green`");
  1096.   ny_disp_emu(cur_user.say_win);
  1097.   od_printf("\n\r");
  1098.   od_printf("`bright`0. `bright red`L`red`oosing `bright red`S`red`entence: `bright green`");
  1099.   ny_disp_emu(cur_user.say_loose);
  1100.   od_printf("\n\r");
  1101.   od_printf("`bright`A. `bright red`D`red`ays `bright red`S`red`ince `bright red`G`red`ot `bright red`L`red`aid: `bright green`%-4d", cur_user.since_got_laid);
  1102.   od_repeat(' ',15);
  1103.   od_printf("`bright`P. `bright red`S`red`TD: `bright green`");
  1104.   print_disease(cur_user.std);
  1105.   od_printf("\n\r`bright`B. `bright red`S`red`ex `bright red`T`red`urns `bright red`L`red`eft: `bright green`%-4d",(int) cur_user.sex_today);
  1106.   od_repeat(' ',20);
  1107.   od_printf("`bright`R. `bright red`I`red`nfected: `bright green`%d%c\n\r",(int) cur_user.std_percent,37);
  1108.   od_printf("`bright`C. `bright red`C`red`ondoms: `bright green`%d\n\r", cur_user.condoms);
  1109.   od_printf("`bright`D. `bright red`R`red`ocks: `bright green`%d\n\r", (int)cur_user.rocks);
  1110.   od_printf("`bright`E. `bright red`A`red`bilities: `bright red`T`red`hrowing:`bright green`%d ", (int)cur_user.throwing_ability);
  1111.   od_printf("`bright red`K`red`icking: `bright green`%d ", (int)cur_user.kick_ability);
  1112.   od_printf("`bright red`P`red`unching: `bright green`%d\n\r", (int)cur_user.punch_ability);
  1113.   od_printf("`bright`F. `bright red`D`red`rug: `bright green`");
  1114.   print_drug(cur_user.drug);
  1115.   od_printf("\n\r`bright`G. `bright red`H`red`its: `bright green`%-6d\n\r",cur_user.drug_hits);
  1116.   od_printf("`bright`H. `bright red`H`red`igh: `bright green`%d%c\n\r",(int)cur_user.drug_high,37);
  1117.   od_printf("`bright`I. `bright red`A`red`ddicted: `bright green`%d%c\n\r",(int)cur_user.drug_addiction,37);
  1118.   od_printf("`bright`J. `bright red`D`red`ays `bright red`S`red`ince `bright red`L`red`ast `bright red`H`red`it: `bright green`%d\n\r",cur_user.drug_days_since);
  1119.   if (cur_user.rest_where==NOWHERE) od_printf("`bright`K. `bright red`S`red`taying `bright red`a`red`t: `bright green`N`green`owhere");
  1120.   else if (cur_user.rest_where==MOTEL) od_printf("`bright`K. `bright red`S`red`taying `bright red`a`red`t: `bright green`C`green`heap `bright green`M`green`otel");
  1121.   else if (cur_user.rest_where==REG_HOTEL) od_printf("`bright`K. `bright red`S`red`taying `bright red`a`red`t: `bright green`R`green`egular `bright green`H`green`otel");
  1122.   else if (cur_user.rest_where==EXP_HOTEL) od_printf("`bright`K. `bright red`S`red`taying `bright red`a`red`t: `bright green`E`green`xpensive `bright green`H`green`otel");
  1123.   od_printf(" `bright red`F`red`or `bright green`%d`bright red` D`red`ays\n\r",(int)cur_user.hotel_paid_fer);
  1124.   od_printf("`blue`-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\r");
  1125. //  od_control.od_ker_exec=ny_kernel;
  1126.  // WaitForEnter();
  1127. }
  1128.  
  1129.  
  1130. void
  1131. print_drug(drug_type drug)
  1132. {
  1133.     od_printf("`bright green`");
  1134.     if (drug==POT) od_printf("P`green`ot");
  1135.     else if (drug==HASH) od_printf("H`green`ash");
  1136.     else if (drug==LSD) od_printf("L`green`SD");
  1137.     else if (drug==COKE) od_printf("C`green`oke");
  1138.     else if (drug==PCP) od_printf("P`green`CP");
  1139.     else if (drug==HEROIN) od_printf("H`green`eroin");
  1140. }
  1141.  
  1142.  
  1143. void
  1144. set_points(unsigned long raise)
  1145. {       // when is time for next level      0   1    2    3    4    5    6     7     8     9     10    11    12    13    14    15    16    17     18     19      //20
  1146.     unsigned long level_seal[LEVELS] = {500,1020,2100,3700,6100,9100,12820,17300,22580,28700,35700,43620,52500,62380,73300,85300,98420,112700,128180,144900};//,162900};
  1147.      /* char c_dir;
  1148.  
  1149.     c_dir=c_dir_g;*/
  1150.  
  1151.  
  1152.     cur_user.level=0;
  1153.     cur_user.points=raise;
  1154.     while (cur_user.level<20 && level_seal[cur_user.level]<=cur_user.points) {
  1155.     //while ( (pow( 10,((double)cur_user.level+1)/2) ) * 25 )<=cur_user.points) {
  1156.       cur_user.level++;
  1157.       if (cur_user.nation==HEADBANGER) {
  1158.         cur_user.strength=(5 * pow(1.3,cur_user.level)+.5);
  1159.         cur_user.defense=(4 * pow(1.3,cur_user.level)+.5);
  1160.       } else if (cur_user.nation==HIPPIE) {
  1161.         cur_user.strength=(4 * pow(1.3,cur_user.level)+.5);
  1162.         cur_user.defense=(4 * pow(1.3,cur_user.level)+.5);
  1163.       } else if (cur_user.nation==BIG_FAT_DUDE) {
  1164.         cur_user.strength=(3 * pow(1.3,cur_user.level)+.5);
  1165.         cur_user.defense=(6 * pow(1.3,cur_user.level)+.5);
  1166.       } else if (cur_user.nation==CRACK_ADDICT) {
  1167.         cur_user.strength=(4 * pow(1.3,cur_user.level)+.5);
  1168.         cur_user.defense=(5 * pow(1.3,cur_user.level)+.5);
  1169.       }
  1170.       else if (cur_user.nation==PUNK) {
  1171.         cur_user.strength=(6 * pow(1.3,cur_user.level)+.5);
  1172.         cur_user.defense=(3 * pow(1.3,cur_user.level)+.5);
  1173.       }
  1174.       cur_user.hitpoints+=.7 * cur_user.maxhitpoints;
  1175.       cur_user.maxhitpoints=(15 * pow(1.7,cur_user.level)+.5);
  1176.     }
  1177.    //   wrt_sts();
  1178. }
  1179.  
  1180. void
  1181. SortScrFile(int usr) // pebble sorting of scorefile
  1182. {
  1183.   FILE *justfile;
  1184.   FILE *scr_file;
  1185.   FILE *fpUserFile;
  1186.   FILE *njustfile;
  1187.   int crnt1,crnt2,cnt,sorted;
  1188.   scr_rec rec[2];
  1189.   user_rec urec;
  1190.   char numstr[20];
  1191.   ffblk ffblk;
  1192.  
  1193.     ch_game_d();
  1194.     scr_file=ShareFileOpen("NY2008.SCR","r+b");
  1195.     fpUserFile=ShareFileOpen(USER_FILENAME,"r+b");
  1196.     if (usr==user_num) {
  1197.       cnt=cur_user.rank;
  1198.     } else {
  1199.       fseek(fpUserFile, (long)usr * sizeof(user_rec), SEEK_SET);
  1200.       ny_fread(&urec, sizeof(user_rec), 1, fpUserFile);
  1201.       cnt=urec.rank;
  1202.     }
  1203.  
  1204.     //od_printf("\n\r\n\r%d\n\r\n\r",cnt);
  1205.  
  1206.     crnt1=0;
  1207.     crnt2=1;
  1208.  
  1209.     strcpy(rec[crnt1].name,cur_user.name);
  1210.     rec[crnt1].nation=cur_user.nation;
  1211.     rec[crnt1].level=cur_user.level;
  1212.     rec[crnt1].points=cur_user.points;
  1213.     rec[crnt1].alive=cur_user.alive;
  1214.     rec[crnt1].sex=cur_user.sex;
  1215.     rec[crnt1].user_num=user_num;
  1216.     rec[crnt1].online=TRUE;
  1217.  
  1218.  
  1219.     fseek(scr_file, (long)cur_user.rank * sizeof(scr_rec), SEEK_SET);
  1220.     ny_fwrite(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  1221.  
  1222.     if (cnt>0) {
  1223.       ch_flag_d();
  1224.       do {
  1225.     sorted=TRUE;
  1226.  
  1227.     fseek(scr_file, (long)(cnt-1) * sizeof(scr_rec), SEEK_SET);
  1228.     ny_fread(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  1229.  
  1230.     fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  1231.     ny_fread(&rec[crnt2], sizeof(scr_rec), 1, scr_file);
  1232.     if (rec[crnt1].points<rec[crnt2].points) { // switch records
  1233.  
  1234.       sorted=FALSE; // run another round
  1235.  
  1236.       sprintf(numstr,"u%07d.on",rec[crnt1].user_num);
  1237.       if (single_node==FALSE && findfirst(numstr,&ffblk,0)==0) {
  1238.         sprintf(numstr,"u%07d.rnk",rec[crnt1].user_num);
  1239.         njustfile = ShareFileOpen(numstr, "wb");
  1240.         ny_fwrite(&cnt,2,1,njustfile);
  1241.         fclose(njustfile);
  1242.       } else {
  1243.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  1244.         ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  1245.         urec.rank=cnt;
  1246.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  1247.         ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  1248.       }
  1249.  
  1250.       if (usr==user_num) {
  1251.         cur_user.rank=cnt-1;
  1252.       } else {
  1253.         sprintf(numstr,"u%07d.on",rec[crnt2].user_num);
  1254.         if (single_node==FALSE && findfirst(numstr,&ffblk,0)==0) {
  1255.           sprintf(numstr,"u%07d.rnk",rec[crnt2].user_num);
  1256.           njustfile = ShareFileOpen(numstr, "wb");
  1257.           cnt--;
  1258.           ny_fwrite(&cnt,2,1,njustfile);
  1259.           cnt++;
  1260.           fclose(njustfile);
  1261.         } else {
  1262.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  1263.           ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  1264.           urec.rank=cnt-1;
  1265.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  1266.           ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  1267.         }
  1268.       }
  1269.  
  1270.       fseek(scr_file, (long)(cnt-1) * sizeof(scr_rec), SEEK_SET);
  1271.       ny_fwrite(&rec[crnt2],sizeof(scr_rec),1,scr_file);
  1272.       fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  1273.       ny_fwrite(&rec[crnt1],sizeof(scr_rec),1,scr_file);
  1274.  
  1275.     }
  1276.     cnt--;
  1277.       } while (sorted==FALSE && cnt>0);
  1278.     }
  1279.     fclose(scr_file);
  1280.     fclose(fpUserFile);
  1281.  
  1282. }
  1283.  
  1284.  
  1285.  
  1286. void
  1287. SortScrFileB(int usr) // pebble sorting of scorefile
  1288. {
  1289.   FILE *justfile;
  1290.   FILE *scr_file;
  1291.   FILE *fpUserFile;
  1292.   FILE *njustfile;
  1293.   int crnt1,crnt2,cnt,sorted,cont;
  1294.   scr_rec rec[2];
  1295.   user_rec urec;
  1296.   char numstr[20];
  1297.   ffblk ffblk;
  1298.  
  1299.  // sort in a certain user either current or an offline user
  1300.     ch_game_d();
  1301.     scr_file=ShareFileOpen("NY2008.SCR","r+b");
  1302.     fpUserFile=ShareFileOpen(USER_FILENAME,"r+b");
  1303.     if (usr==user_num) {
  1304.       cnt=cur_user.rank;
  1305.     } else {
  1306.       fseek(fpUserFile, (long)usr * sizeof(user_rec), SEEK_SET);
  1307.       ny_fread(&urec, sizeof(user_rec), 1, fpUserFile);
  1308.       cnt=urec.rank;
  1309.     }
  1310.     //od_printf("\n\r\n\r%d\n\r\n\r",cnt);
  1311.  
  1312.     crnt1=0;
  1313.     crnt2=1;
  1314.  
  1315.     strcpy(rec[crnt1].name,cur_user.name);
  1316.     rec[crnt1].nation=cur_user.nation;
  1317.     rec[crnt1].level=cur_user.level;
  1318.     rec[crnt1].points=cur_user.points;
  1319.     rec[crnt1].alive=cur_user.alive;
  1320.     rec[crnt1].sex=cur_user.sex;
  1321.     rec[crnt1].user_num=user_num;
  1322.     rec[crnt1].online=TRUE;
  1323.  
  1324.  
  1325.     fseek(scr_file, (long)cur_user.rank * sizeof(scr_rec), SEEK_SET);
  1326.     ny_fwrite(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  1327.     cont=filelength(fileno(scr_file))/sizeof(scr_rec);
  1328.  
  1329.     if (cnt<(cont-1)) {
  1330.       ch_flag_d();
  1331.       do {
  1332.     sorted=TRUE;
  1333.  
  1334.     fseek(scr_file, (long)(cnt+1) * sizeof(scr_rec), SEEK_SET);
  1335.     ny_fread(&rec[crnt1], sizeof(scr_rec), 1, scr_file);
  1336.  
  1337.     fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  1338.     ny_fread(&rec[crnt2], sizeof(scr_rec), 1, scr_file);
  1339.     if (rec[crnt1].points>rec[crnt2].points) { // switch records
  1340.  
  1341.       sorted=FALSE; // run another round
  1342.  
  1343.       sprintf(numstr,"u%07d.on",rec[crnt1].user_num);
  1344.       if (single_node==FALSE && findfirst(numstr,&ffblk,0)==0) {
  1345.         sprintf(numstr,"u%07d.rnk",rec[crnt1].user_num);
  1346.         njustfile = ShareFileOpen(numstr, "wb");
  1347.         ny_fwrite(&cnt,2,1,njustfile);
  1348.         fclose(njustfile);
  1349.       } else {
  1350.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  1351.         ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  1352.         urec.rank=cnt;
  1353.         fseek(fpUserFile, (long)rec[crnt1].user_num * sizeof(user_rec), SEEK_SET);
  1354.         ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  1355.       }
  1356.  
  1357.       if (usr==user_num) {
  1358.         cur_user.rank=cnt+1;
  1359.       } else {
  1360.         sprintf(numstr,"u%07d.on",rec[crnt2].user_num);
  1361.         if (single_node==FALSE && findfirst(numstr,&ffblk,0)==0) {
  1362.           sprintf(numstr,"u%07d.rnk",rec[crnt2].user_num);
  1363.           njustfile = ShareFileOpen(numstr, "wb");
  1364.           cnt++;
  1365.           ny_fwrite(&cnt,2,1,njustfile);
  1366.           cnt--;
  1367.           fclose(njustfile);
  1368.         } else {
  1369.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  1370.           ny_fread(&urec,sizeof(user_rec),1,fpUserFile);
  1371.           urec.rank=cnt+1;
  1372.           fseek(fpUserFile, (long)rec[crnt2].user_num * sizeof(user_rec), SEEK_SET);
  1373.           ny_fwrite(&urec,sizeof(user_rec),1,fpUserFile);
  1374.         }
  1375.       }
  1376.  
  1377.       fseek(scr_file, (long)(cnt+1) * sizeof(scr_rec), SEEK_SET);
  1378.       ny_fwrite(&rec[crnt2],sizeof(scr_rec),1,scr_file);
  1379.       fseek(scr_file, (long)cnt * sizeof(scr_rec), SEEK_SET);
  1380.       ny_fwrite(&rec[crnt1],sizeof(scr_rec),1,scr_file);
  1381.  
  1382.     }
  1383.     cnt++;
  1384.       } while (sorted==FALSE && cnt<(cont-1));
  1385.     }
  1386.     fclose(scr_file);
  1387.     fclose(fpUserFile);
  1388.  
  1389. }
  1390.  
  1391. void
  1392. print_disease(desease ill)
  1393. {
  1394.     od_printf("`bright green`");
  1395.     if (ill==NONE) od_printf("H`green`ealthy");
  1396.     else if (ill==CRAPS) od_printf("C`green`rabs");
  1397.     else if (ill==HERPES) od_printf("H`green`erpes");
  1398.     else if (ill==SYPHILIS) od_printf("S`green`yphilis");
  1399.     else if (ill==AIDS) od_printf("A`green`IDS");
  1400. }
  1401.  
  1402.  
  1403.  
  1404.  
  1405. void
  1406. print_arm(weapon arm)
  1407. {
  1408.     if (arm==HANDS)
  1409.        od_printf("`bright green`H`green`ands");
  1410.     else if (arm==PEPPER)
  1411.        od_printf("`bright green`P`green`epper `bright green`S`green`pray");
  1412.     else if (arm==KNIFE)
  1413.        od_printf("`bright green`K`green`nife");
  1414.     else if (arm==CHAIN)
  1415.        od_printf("`bright green`C`green`hain");
  1416.     else if (arm==GUN)
  1417.        od_printf("`bright green`G`green`un");
  1418.     else if (arm==RIFLE)
  1419.        od_printf("`bright green`R`green`ifle");
  1420.     else if (arm==LASER_GUN)
  1421.        od_printf("`bright green`L`green`aser `bright green`G`green`un");
  1422.     else if (arm==SHOTGUN)
  1423.        od_printf("`bright green`S`green`hotgun");
  1424.     else if (arm==MACHINEGUN)
  1425.        od_printf("`bright green`M`green`achine `bright green`G`green`un");
  1426.     else if (arm==GRANADE_LAUNCHER)
  1427.        od_printf("`bright green`G`green`ranade `bright green`L`green`auncher");
  1428.     else if (arm==BLASTER)
  1429.        od_printf("`bright green`B`green`laster");
  1430.     else if (arm==A_BOMB)
  1431.        ny_disp_emu("`0A`2tomic `0B`2omb");
  1432.     else if (arm==SHARP_STICK)
  1433.        ny_disp_emu("`0S`2harp `0S`2tick");
  1434.     else if (arm==SCREWDRIVER)
  1435.        ny_disp_emu("`0S`2crewdriver");
  1436.     else if (arm==HAMMER)
  1437.        ny_disp_emu("`0H`2ammer");
  1438.     else if (arm==LEAD_PIPE)
  1439.        ny_disp_emu("`0L`2ead `0P`2ipe");
  1440.     else if (arm==COLT)
  1441.        ny_disp_emu("`0C`2olt");
  1442.     else if (arm==ELEPHANT_GUN)
  1443.        ny_disp_emu("`0E`2lephant `0G`2un");
  1444.     else if (arm==NAILGUN)
  1445.        ny_disp_emu("`0N`2ail `0G`2un");
  1446.     else if (arm==ASSAULT_RIFLE)
  1447.        ny_disp_emu("`0A`2ssault `0R`2ifle");
  1448.     else if (arm==PROTON_GUN)
  1449.        ny_disp_emu("`0P`2roton `0G`2un");
  1450.     else if (arm==NEUTRON_PHASER)
  1451.        ny_disp_emu("`0N`2Neutron `0P`2haser");
  1452.     else if (arm==ULTRASOUND_GUN)
  1453.        ny_disp_emu("`0U`2ltrasound `0G`2un");
  1454.  
  1455. }
  1456.  
  1457.  
  1458. /* The WriteCurrentUser() function is called to save the information on the */
  1459. /* user who is currently using the door, to the ny2008.USR file.            */
  1460. void WriteCurrentUser(int user_num)
  1461. {
  1462.    FILE *fpUserFile;
  1463.    ny_kernel();
  1464.  
  1465.    /* Attempt to open the user file for exclusize access by this node.     */
  1466.    /* This function will wait up to the pre-set amount of time (as defined */
  1467.    /* near the beginning of this file) for access to the user file.        */
  1468.    ch_game_d();
  1469.    fpUserFile = ShareFileOpen(USER_FILENAME, "r+b");
  1470.  
  1471.    /* If unable to access the user file, display an error message and */
  1472.    /* return.                                                         */
  1473.    if(fpUserFile == NULL)
  1474.    {
  1475.       od_printf("Unable to access the user file.\n\r");
  1476.       WaitForEnter();
  1477.       return;
  1478.    }
  1479.  
  1480.    /* Move to appropriate location in user file for the current user's */
  1481.    /* record. */
  1482.    fseek(fpUserFile, (long)user_num * sizeof(user_rec), SEEK_SET);
  1483.  
  1484.    /* Write the new record to the file. */
  1485.    if(ny_fwrite(&cur_user, sizeof(user_rec), 1, fpUserFile) == 0)
  1486.    {
  1487.       /* If unable to write the record, display an error message. */
  1488.       fclose(fpUserFile);
  1489.       od_printf("Unable to update user record file.\n\r");
  1490.       WaitForEnter();
  1491.       return;
  1492.    }
  1493.  
  1494.    /* Close the user file to allow other nodes to access it again. */
  1495.    fclose(fpUserFile);
  1496. }
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504. /* This function opens the specified file in the specified mode for         */
  1505. /* exculsive access by this node; while the file is open, other nodes will  */
  1506. /* be unable to open the file. This function will wait for up to the number */
  1507. /* of seconds set by FILE_ACCESS_MAX_WAIT, which is defined near the        */
  1508. /* beginning of this file.                                                  */
  1509. //FILE *ExculsiveFileOpen(char *pszFileName, char *pszMode)
  1510. //{
  1511. //   FILE *fpFile = NULL;
  1512. //   time_t StartTime = time(NULL);
  1513.  
  1514.    /* Attempt to open the file while there is still time remaining. */
  1515. //   while((fpFile = fopen(pszFileName, pszMode)) == NULL
  1516. //      && errno == EACCES
  1517. //      && difftime(time(NULL), StartTime) < FILE_ACCESS_MAX_WAIT)
  1518. //   {
  1519.       /* If we were unable to open the file, call od_kernal, so that    */
  1520.       /* OpenDoors can continue to respond to sysop function keys, loss */
  1521.       /* of connection, etc.                                            */
  1522.  //     od_kernal();
  1523.  //  }
  1524.  
  1525.    /* Return FILE pointer for opened file, if any. */
  1526. //   return(fpFile);
  1527. //}
  1528.  
  1529. /* The WaitForEnter() function is used to create custom prompt */
  1530.  
  1531. void WaitForEnter(void)
  1532. {
  1533.    /* Display prompt. */
  1534.    od_printf("\n\r`bright red`Smack [ENTER] to go on.");
  1535.  
  1536.    /* Wait for a Carriage Return or Line Feed character from the user. */
  1537.    od_get_answer("\n\r");
  1538. }
  1539.  
  1540.  
  1541.  
  1542.  
  1543. /* CustomConfigFunction() is called by OpenDoors to process custom */
  1544. /* configuration file keywords that                                */
  1545. void CustomConfigFunction(char *pszKeyword, char *pszOptions)
  1546. {
  1547.   if(stricmp(pszKeyword, "SingleNodeOnly") == 0)
  1548.   {
  1549.     single_node=TRUE;
  1550.   }
  1551.   else if(stricmp(pszKeyword, "FlagDirectory") == 0)
  1552.   {
  1553.     strupr(pszOptions);
  1554.  
  1555.     flagdisk=(*pszOptions) - 'A';
  1556.  
  1557.     strzcpy(flagdir,pszOptions,2,MAXDIR);
  1558.   }
  1559.   else if(stricmp(pszKeyword, "PollingValue") == 0)
  1560.   {
  1561.     if(time_slice_value!=0)
  1562.       sscanf(pszOptions,"%d",&time_slice_value);
  1563.   }
  1564.   else if(stricmp(pszKeyword, "NoMultitasker") == 0)
  1565.   {
  1566.     time_slice_value=0;
  1567.   }
  1568. }
  1569.  
  1570.  
  1571. void
  1572. ny_disp_emu(char line[])
  1573. {
  1574.   int cnt;
  1575.  
  1576.   for(cnt=0;line[cnt]!=0;cnt++) {
  1577.     if(line[cnt]=='`') {
  1578.       cnt++;
  1579.       if(line[cnt]==0)
  1580.     return;
  1581.       else if(line[cnt]=='0')
  1582.     od_printf("`bright green`");
  1583.       else if(line[cnt]=='1')
  1584.     od_printf("`blue`");
  1585.       else if(line[cnt]=='2')
  1586.     od_printf("`green`");
  1587.       else if(line[cnt]=='3')
  1588.     od_printf("`cyan`");
  1589.       else if(line[cnt]=='4')
  1590.     od_printf("`red`");
  1591.       else if(line[cnt]=='5')
  1592.     od_printf("`magenta`");
  1593.       else if(line[cnt]=='6')
  1594.     od_printf("`brown`");
  1595.       else if(line[cnt]=='7')
  1596.     od_printf("`white`");
  1597.       else if(line[cnt]=='8')
  1598.     od_printf("`bright black`");
  1599.       else if(line[cnt]=='9')
  1600.     od_printf("`bright blue`");
  1601.       else if(line[cnt]=='!')
  1602.     od_printf("`bright cyan`");
  1603.       else if(line[cnt]=='@')
  1604.     od_printf("`bright red`");
  1605.       else if(line[cnt]=='#')
  1606.     od_printf("`bright magenta`");
  1607.       else if(line[cnt]=='$')
  1608.     od_printf("`bright yellow`");
  1609.       else if(line[cnt]=='%')
  1610.     od_printf("`bright`");
  1611.     } else {
  1612.       od_putch(line[cnt]);
  1613.     }
  1614.   }
  1615. }
  1616.  
  1617.  
  1618. void
  1619. get_bbsname(char bbsname[])
  1620. {
  1621.   int cnt=0;
  1622.   char out[36];
  1623.   int cnto=0;
  1624.  
  1625.   while (bbsname[cnt]!=0 && cnto<35) {
  1626.     if (bbsname[cnt]>='a' && bbsname[cnt]<='z') bbsname[cnt]-=32;
  1627.  
  1628.     if (bbsname[cnt]>='A' && bbsname[cnt]<='Z') {
  1629.       out[cnto]=bbsname[cnt];
  1630.       cnto++;
  1631.     }
  1632.  
  1633.     cnt++;
  1634.   }
  1635.   out[cnto]=0;
  1636.   strcpy(bbsname,out);
  1637. }
  1638.  
  1639.  
  1640. int
  1641. seereg(char bbsname[])
  1642. {
  1643.   return TRUE;
  1644. /*  FILE *justfile;
  1645.  
  1646.   char kod[26];
  1647.   char string[26] = "ABECEDAKURVAHLEDAPICATAKY";
  1648.   int intval;
  1649.   int cnt;
  1650.   int bbsc;
  1651.   int which;
  1652.   int temp,temp2;
  1653.  
  1654.   ch_game_d();
  1655.   justfile=ShareFileOpen("NYREG.KEY","rb");
  1656.  
  1657.   ny_fread(kod,26,1,justfile);
  1658.  
  1659.   fclose(justfile);
  1660.  
  1661.  
  1662.   sscanf(kod,"%02d",&intval);
  1663.  
  1664.   if (intval!=strlen(bbsname)) {
  1665.     return(0);
  1666.   }
  1667.  
  1668.   intval = kod[0] - '0';
  1669.  
  1670.   bbsc=0;
  1671.  
  1672.   which=0;
  1673.  
  1674.   for (cnt=2;cnt<25;cnt++) {
  1675.     if (bbsname[bbsc]==0) bbsc=0;
  1676.  
  1677.     temp2=string[cnt]+intval+bbsname[bbsc];
  1678.  
  1679. //    if (kod[cnt]>'Z') kod[cnt]-=('Z'-'A');
  1680.     temp =  (temp2-'A')/('Z'-'A');
  1681.  
  1682.     temp2 = temp2 - (('Z'-'A') * temp);
  1683.  
  1684.     if (kod[cnt]!=temp2) {
  1685.       return(0);
  1686.     }
  1687.  
  1688.     if (which==0)
  1689.       which =1;
  1690.     else
  1691.       which =0;
  1692.  
  1693.     intval = kod[which] - '0';
  1694.     bbsc++;
  1695.   }
  1696.  
  1697.   return(TRUE);*/
  1698. }
  1699.  
  1700. size_t
  1701. ny_fwrite(const void *ptr, size_t size, size_t n, FILE *stream)
  1702. {
  1703.   size_t status;
  1704.   long offset;
  1705.   offset=ftell(stream);
  1706.  
  1707.   if(single_node==FALSE && filelength(fileno(stream))>=offset+(size*n)) {
  1708.     //offset=ftell(stream);
  1709.  
  1710.     lock(fileno(stream),offset,size * n);
  1711.     status=fwrite(ptr,size,n,stream);
  1712.     unlock(fileno(stream),offset,size * n);
  1713.   } else {
  1714.     status=fwrite(ptr,size,n,stream);
  1715.   }
  1716.   return(status);
  1717. }
  1718.  
  1719.  
  1720. size_t
  1721. ny_fread(const void *ptr, size_t size, size_t n, FILE *stream)
  1722. {
  1723.   size_t status;
  1724.   long offset;
  1725.  
  1726.   if(single_node==FALSE && filelength(fileno(stream))>=offset+(size*n)) {
  1727.     offset=ftell(stream);
  1728.  
  1729.     lock(fileno(stream),offset,size * n);
  1730.     status=fread(ptr,size,n,stream);
  1731.     unlock(fileno(stream),offset,size * n);
  1732.   } else {
  1733.     status=fread(ptr,size,n,stream);
  1734.   }
  1735.   return(status);
  1736. }
  1737.  
  1738.  
  1739.  
  1740.  
  1741. /* This function opens the specified file in the specified mode for         */
  1742. /* share access by this node; while the file is open, other nodes will      */
  1743. /* be able to open the file. This function will wait for up to the number   */
  1744. /* of seconds set by FILE_ACCESS_MAX_WAIT, which is defined near the        */
  1745. /* beginning of this file.                                                  */
  1746. FILE *ShareFileOpen(char *pszFileName, char *pszMode)
  1747. {
  1748.    FILE *fpFile = NULL;
  1749.    time_t StartTime = time(NULL);
  1750.  
  1751.    /* Attempt to open the file while there is still time remaining. */
  1752.    ny_kernel();
  1753.    if(single_node==FALSE) {
  1754.      while((fpFile = _fsopen(pszFileName, pszMode,SH_DENYNO)) == NULL
  1755.     && errno == EACCES
  1756.     && difftime(time(NULL), StartTime) < FILE_ACCESS_MAX_WAIT)
  1757.      {
  1758.       /* If we were unable to open the file, call od_kernal, so that    */
  1759.       /* OpenDoors can continue to respond to sysop function keys, loss */
  1760.       /* of connection, etc.                                            */
  1761.     od_kernal();
  1762.      }
  1763.    } else {
  1764.      fpFile = fopen(pszFileName, pszMode);
  1765.    }
  1766.  
  1767.    /* Return FILE pointer for opened file, if any. */
  1768.    return(fpFile);
  1769. }
  1770.  
  1771. void
  1772. ch_game_d(void)
  1773. {
  1774.  if(c_dir_g==1) {
  1775.    setdisk(gamedisk);
  1776.    chdir(gamedir);
  1777.    c_dir_g=0;
  1778.  }
  1779. }
  1780.  
  1781. void
  1782. ch_flag_d(void)
  1783. {
  1784.  if(c_dir_g==0) {
  1785.    setdisk(flagdisk);
  1786.    chdir(flagdir);
  1787.    c_dir_g=1;
  1788.  }
  1789. }
  1790.